/**
 * @检验字符串是否相等
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>

bool strings(const char s1[], const char s2[]);

int main(int argc, char *argv[]) {
	const char s1[] = "string compare test";
	const char s2[] = "string";

	printf("%d\n", strings(s1, s2));
	printf("%d\n", strings(s2, s2));
	printf("%d\n", strings(s2, "string"));

	return 0;
}

//检验两个字符串是否相等
bool strings(const char s1[], const char s2[]) {
	bool s;
	int i = 0;

	while (s1[i] == s2[i] && s1[i] != '\0') {
		i++;
	}

	if (s1[i] == '\0' && s2[i] == '\0') {
		s = true;
	} else {
		s = false;
	}

	return s;
}
